package com.situ.day12;

public class MoneyManager {

	private Double balance;
	private String name;

	public MoneyManager(Double balance, String name) {
		super();
		this.balance = balance;
		this.name = name;
	}

	// 存钱deposite
	public void deposite(double money) {
		balance += money;
	}

	// 取钱withdraw
	public void withdraw(double money) throws MyException {
		if (balance >= money) {
			balance -= money;
		} else {
			double need = money - balance;
			throw new MyException(need);
		}
	}

}
